package com.itheima.health.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.itheima.health.common.R;
import com.itheima.health.entity.CheckGroup;
import com.itheima.health.service.CheckGroupService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/checkgroup")
@Slf4j
public class CheckGroupController {

    @Autowired
    private CheckGroupService checkGroupService;

    @GetMapping("/page")
    public R<Page> page(Integer page,Integer pageSize,String code){
        Page byPage = checkGroupService.getByPage(page, pageSize, code);

        return R.success(byPage);
    }

    @GetMapping("/list")
    public R<List<CheckGroup>> listAll(){

        List<CheckGroup> list = checkGroupService.list();
        return R.success(list);
    }
}
